<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:jsf="http://java.sun.com/xml/ns/javaee">
	<xsl:output method="html" encoding="utf-8" indent="yes"/>
	<xsl:param name="version"></xsl:param>
	<xsl:template match="/">
		<xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text>
		<html>
			<head>
				<title>
					<xsl:value-of select="jsf:facelet-taglib/@id"/> TagLibrary</title>
				<meta charset="utf-8"/>
				<link rel="stylesheet" href="css/normalize.css" type="text/css"/>
				<link rel="stylesheet" href="css/main.css" type="text/css"/>
				<script type="text/javascript" src="js/jquery-1.6.4.js" />
				<script type="text/javascript" src="js/modernizr.js" />
			</head>
			<body>
				<div id="pagewidth">
					<header id="header">
						<h2>
							<xsl:value-of select="jsf:facelet-taglib/@id"/> TagLibrary</h2>
					</header>
					<div id="wrapper" class="clearfix">
						<div id="twocols">
							<section id="maincol">
								<xsl:for-each select="//jsf:tag">
									<xsl:element name="article">
										<xsl:attribute name="id"><xsl:value-of select="jsf:tag-name"/></xsl:attribute>
										<header>
											<h3>
												Tag - <xsl:value-of select="jsf:tag-name"/>
											</h3>
										</header>
										<section class="taginfo">
											<table>
												<caption>Tag Information</caption>
												<tbody>
													<xsl:for-each select="jsf:component/*">
														<tr>
															<td>
																<xsl:value-of select="local-name(.)"/>
															</td>
															<td>
																<xsl:value-of select="."/>
															</td>
														</tr>
													</xsl:for-each>
												</tbody>
											</table>
										</section>
										<section class="tagattr">
											<table>
												<caption>Attributes</caption>
												<thead>
													<tr>
														<th>Name</th>
														<th>Type</th>
														<th>Description</th>
													</tr>
												</thead>
												<tbody>
													<xsl:for-each select="jsf:attribute">
														<tr>
															<td>
																<xsl:value-of select="jsf:name"/>
															</td>
															<td>
																<xsl:value-of select="jsf:type"/>
															</td>
															<td>
																<xsl:value-of disable-output-escaping="yes" select="jsf:description"/>
															</td>
														</tr>
													</xsl:for-each>
												</tbody>
											</table>
										</section>
									</xsl:element>
								</xsl:for-each>
							</section>
							<div id="rightcol">
								<header>
									<h3>All Tags / Functions</h3>
								</header>
								<ul>
									<xsl:for-each select="//jsf:tag">
										<li>
											<xsl:element name="a">
												<xsl:attribute name="href">#</xsl:attribute>
												<xsl:value-of select="jsf:tag-name"/>
											</xsl:element>
										</li>
									</xsl:for-each>
								</ul>
							</div>
						</div>
					</div>
					<footer id="footer">
						<p class="info"><xsl:value-of select="jsf:facelet-taglib/@id"/> TagLibrary - version <xsl:value-of select="$version" /></p>
					</footer>
				</div>
				<script type="text/javascript">
					$("tbody tr:odd").addClass("odd");
					$("#maincol > article").hide();
					$("#maincol > article:first-child").show();
					$("#rightcol li:first-child a").addClass('active');
					$("#rightcol li a").click(function() {
					  var $this = $(this);
					  $("#maincol > article").hide("slow");
					  $("#maincol > article[id='" + $this.text() + "']").show("slow");
					  $("#rightcol li a").removeClass('active')
					  $this.addClass('active');
					});
				</script>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>
